Method and apparatus for forwarding mpls data packet

ABSTRACT

A method and an apparatus for forwarding an MPLS data packet are provided, which are used in an environment of hybrid networking of an SR network and a non-SR network. The method includes: when obtaining a to-be-sent MPLS data packet, a first SR router in an SR network determines whether a next-hop router supports an SR characteristic; the first SR router encapsulates the MPLS data packet into an IP tunnel when determining that the next-hop router does not support the SR characteristic, and sends an encapsulated MPLS data packet to the next-hop router to enable the encapsulated MPLS data packet to be forwarded, based on an IP routing table, to a second SR router. According to the application, correct forwarding of an MPLS data packet is completed in an environment of hybrid networking of an SR router and a non-SR router.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No. 16/360,965, filed on Mar. 21, 2019, which is a continuation of U.S. patent application Ser. No. 15/044,779, filed on Feb. 16, 2016, now U.S. Pat. No. 10,277,504, which is a continuation of International Patent Application No. PCT/CN2014/081725, filed on Jul. 7, 2014, which claims priority to Chinese Patent Application No. 201310356579.0, filed on Aug. 15, 2013. All of the afore-mentioned patent applications are hereby incorporated by reference in their entireties.

TECHNICAL FIELD

Embodiment of the present invention relate to network communications technologies, and in particular, to a method and an apparatus for forwarding an MPLS data packet.

BACKGROUND

Segment routing (SR) is a method for transferring, by a control plane by using the Interior Gateway Protocol (IGP), a Multiprotocol Label Switching (MPLS) label that has a global meaning or local meaning and is corresponding to an SR router. Typical IGPs are the Intermediate System to Intermediate System (IS-IS) protocol and the Open Shortest Path First (OSPF) protocol.

A data plane performs MPLS data packet forwarding based on an MPLS label delivered by a Segment Routing control plane, so as to achieve an objective of simplifying operation and maintenance management of an MPLS network.

To facilitate understanding of a segment routing technical solution, the following example is presented for a scenario where a control plane delivers a label having a global meaning.

Referring to FIG. 1, an egress SR router (that is, element Z) advertises its own node segment label according to a method defined by a segment routing protocol and by using an IGP protocol (such as IS-IS or OSPF) extension, and it is assumed that the node segment label is 65 (see FIG. 1). When an ingress SR router (that is, element A) needs to send an original data packet to Z, the ingress SR router adds a node segment Label (that is, “65”) corresponding to Z before the original data packet, and then sends, to a next-hop SR router (that is, element B), an MPLS packet that is formed after the original data packet is encapsulated. In a subsequent process, an SR router (such as elements B, C, and D) that receives the foregoing MPLS data packet forwards hop-by-hop the foregoing MPLS data packet to a destination Z according to the node segment label (that is, “65”).

However, a scenario of hybrid networking of an SR router and a non-SR router is not considered in an existing Segment Routing technical solution. Referring to FIG. 2, it is assumed that C does not support an SR characteristic, but according to provisions in ISIS and OSPF protocols, on a control plane, when an ISIS or OSPF node receives a type-length-value (TLV) that the ISIS or OSPF node does not know, the ISIS or the OSPF node still sends the TLV to a neighboring node. That is, when receiving a TLV that includes SR related information (for example, a node segment Label), although C cannot identify the TLV, C still advertises the TLV to a surrounding neighboring node, such as B and D. However, on a data plane, when B forwards, to C, an MPLS data packet (a top label of the data packet is the node segment label corresponding to Z, that is, the label 65) that is received from A and whose destination is Z, C discards the received MPLS data packet because C does not support the SR characteristic (that is, a corresponding MPLS forwarding entry does exist on the data plane).

Therefore, the inventor noticed the following issues exist in the conventional art: when router hybrid networking of an SR router and a non-SR router is used, a packet discard phenomenon occurs because a router does not support an SR characteristic inevitably, which results in that an MPLS data packet cannot be correctly forwarded in a hybrid networking environment.

SUMMARY

Embodiments of the present application provide a method and an apparatus for forwarding an MPLS data packet, which are used to implement correct forwarding of the MPLS data packet in a scenario of hybrid networking of an SR router and a non-SR router.

Specific technical solutions provided in the embodiments of the present application are as follows:

According to a first aspect, a method for forwarding an MPLS data packet is provided, including:

receiving, by a first SR router in an SR network, the MPLS data packet; and

encapsulating, by the first SR router, the MPLS data packet into an IP tunnel when determining that a next-hop router does not support an SR characteristic, and sending an encapsulated MPLS data packet to the next-hop router to enable the encapsulated MPLS data packet to be forwarded, based on an IP routing table, to a second SR router.

With reference to the first aspect, in a first possible implementation manner, the encapsulating, by the first SR router, the MPLS data packet into an IP tunnel specifically includes:

filling in, by the first SR router, a source address of the IP tunnel with an IP address of the first SR router, and filling in a destination address of the IP tunnel with an IP address of the second SR router.

With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, the method further includes:

learning, by the first SR router, the IP address of the second SR router according to a node segment label at the top of a label stack of the to-be-sent MPLS data packet, where the node segment label at the top of the label stack of the MPLS data packet is a node segment label of the second SR router.

With reference to the first aspect, in a third possible implementation manner, before the encapsulating, by the first SR router, the MPLS data packet into an IP tunnel, the method includes:

determining, by the first SR router, whether a node segment label of the second SR router is a global label; and

if the node segment label is a global label, further determining, by the first SR router, whether a penultimate hop pop PHP operation needs to be performed on the global label, where if the PHP operation needs to be performed, a pop operation is performed on the global label, or if the PHP operation does not need to be performed, a pop operation is not performed on the global label; or

if the node segment label is a local label, directly performing, by the first SR router, a pop operation on the local label.

With reference to any one of the foregoing possible implementation manners of the first aspect, in a fourth possible implementation manner, before the encapsulating, by the first SR router, the MPLS data packet into an IP tunnel, the method further includes:

learning, by the first SR router according to a tunnel encapsulation capability advertisement sent by the second SR router, an IP tunnel encapsulation type that is used when the MPLS data packet is encapsulated into the IP tunnel.

According to a second aspect, a first SR router is provided, including:

a communications unit, configured to receive an MPLS data packet; and

a processing unit, configured to encapsulate the MPLS data packet into an IP tunnel when determining that a next-hop router does not support an SR characteristic, and send an encapsulated MPLS data packet to the next-hop router by using the communications unit to enable the encapsulated MPLS data packet to be forwarded, based on an IP routing table, to a second SR router.

With reference to the second aspect, in a first possible implementation manner, that the processing unit encapsulates the MPLS data packet into the IP tunnel specifically includes that:

the processing unit fills in a source address of the IP tunnel with an IP address of the first SR router, and fills in a destination address of the IP tunnel with an IP address of the second SR router.

With reference to the first possible implementation manner of the second aspect, in a second possible implementation manner, the processing unit is further configured to:

learn the IP address of the second SR router according to a node segment label at the top of a label stack of the to-be-sent MPLS data packet, where the node segment label at the top of the label stack of the MPLS data packet is a node segment label of the second SR router.

With reference to the second aspect, in a third possible implementation manner, before the processing unit encapsulates the MPLS data packet into the IP tunnel, the following is included:

the processing unit determines whether a node segment label of the second SR router is a global label; and

if the node segment label is a global label, the processing unit further determines whether a penultimate hop pop PHP operation needs to be performed on the global label, where

if the PHP operation needs to be performed, a pop operation is performed on the global label, or if the PHP operation does not need to be performed, a pop operation is not performed on the global label; or

if the node segment label is a local label, the processing unit directly performs a pop operation on the local label.

With reference to any one of the foregoing possible implementation manners of the second aspect, in a fourth possible implementation manner, the processing unit is further configured to:

before encapsulating the MPLS data packet into the IP tunnel, learn, according to a tunnel encapsulation capability advertisement sent by the second SR router, an IP tunnel encapsulation type that is used when the MPLS data packet is encapsulated into the IP tunnel.

In the embodiments of the present application, when obtaining a to-be-sent MPLS data packet, a first SR router in an SR network determines whether a next-hop router supports an SR characteristic; the first SR router encapsulates the MPLS data packet into an IP tunnel when determining that the next-hop router does not support the SR characteristic, and sends an encapsulated MPLS data packet to the next-hop router to enable the encapsulated MPLS data packet to be forwarded, based on an IP routing table, to a second SR router. In this way, correct forwarding of an MPLS data packet is completed in an environment of hybrid networking of an SR router and a non-SR router, thereby a requirement for incremental deployment of SR networks is met.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic diagram of Segment Routing MPLS forwarding;

FIG. 2 is a schematic diagram of an error in Segment Routing MPLS forwarding;

FIG. 3 is a flowchart of forwarding an MPLS data packet in a hybrid networking environment according to an embodiment of the present application;

FIG. 4 is a first schematic diagram of forwarding an MPLS data packet in a hybrid networking environment according to an embodiment of the present application;

FIG. 5 is a second schematic diagram of forwarding an MPLS data packet in a hybrid networking environment according to an embodiment of the present application;

FIG. 6 is a schematic diagram of an encapsulation capability sub-type-length-value advertised by an SR router according to an embodiment of the present application; and

FIG. 7 and FIG. 8 are schematic structural diagrams of a first SR router according to an embodiment of the present application.

DESCRIPTION OF EMBODIMENTS

To support a scenario of hybrid networking of an SR router and a non-SR router, in embodiments of the present application, a conventional network (that is, a non-SR network) is connected to nodes in a Segment routing network, thereby facilitating incremental deployment of segment routing networks.

The following describes exemplary embodiments of the present application in detail with reference to accompanying drawings.

Referring to FIG. 3, in a hybrid networking environment, a process of forwarding an MPLS data packet is as follows:

Step 300: After receiving the MPLS data packet, a first SR router in an SR network determines whether a next-hop router supports an SR characteristic.

In this embodiment of the present application, each SR router in a Segment routing network advertises its own SR capability in an entire IGP domain by using an IGP extension. Therefore, each SR router may automatically learn whether a next-hop router supports the SR characteristic.

Step 310: When determining that the next-hop router does not support the SR characteristic, the first SR router encapsulates the to-be-sent MPLS data packet into an IP tunnel, and sends an encapsulated MPLS data packet to the next-hop router to enable the encapsulated MPLS data packet to be forwarded, based on an IP routing table, to a second SR router.

That is, the first SR router encapsulates the MPLS data packet into an IP data packet, and then forwards, based on an IP routing table, the IP data packet that is formed after encapsulation to the second SR router that serves as a destination of the tunnel.

In this embodiment of the present application, when encapsulating the MPLS data packet into the IP tunnel, the first SR router fills in a source address of the IP tunnel with an IP address of the first SR router, and fills in a destination address of the IP tunnel with an IP address of the second SR router. The first SR router learns the IP address of the second SR router according to a node segment label (that is, a node segment label of the second SR router) at the top of a label stack of the MPLS data packet, that is, a mapping relationship exists between the node segment label of the second SR router and the IP address of the second SR router. The first SR router may learn the IP address of the second SR router according to the node segment label at the top of the label stack of the MPLS data packet when encapsulating the MPLS data packet into the IP tunnel.

According to another aspect, before encapsulating the MPLS data packet into the IP tunnel, the first SR router may determine, based on the node segment label of the second SR router, whether the node segment label is a global label, if the node segment label is a global label, further determine whether a penultimate hop pop (PHP) operation needs to be performed on the global label, where if the PHP operation needs to be performed, a pop operation is performed on the global label; or if the PHP operation does not need to be performed, a pop operation is not performed on the global label; or if the node segment label is a local label, the first SR router directly performs a pop operation on the local label.

In the foregoing embodiment, further, the first SR router learns, according to a notification of the second SR router, an IP tunnel encapsulation type (that is, a type of a header of an encapsulation IP tunnel) that is used when the MPLS data packet is encapsulated into the IP tunnel. For example, before encapsulating the MPLS data packet into the IP tunnel, the first SR router may learn, according to a tunnel encapsulation capability advertisement sent by the second SR router, the IP tunnel encapsulation type that is used when the MPLS data packet is encapsulated into the IP tunnel, for example, a generic routing encapsulation (GRE) tunnel type. Certainly, an IP tunnel encapsulation format that is to be used may also be agreed on in advance between SR routers in a system.

The following uses several specific application scenarios to further describe the foregoing embodiment in detail.

It is assumed that A is an ingress SR router, B and D are intermediate SR routers, C is a Non-SR router, and Z is an egress SR router. In this case, when receiving, from A, an MPLS data packet whose top label is a node segment label (that is, “65”) corresponding to Z, B finds that a next-hop (that is, element C) in an MPLS forwarding entry corresponding to the MPLS data packet is a non-SR router, and then, B determines whether the node segment label corresponding to Z is a global label. If the node segment label corresponding to Z is a global label, B further determines whether a PHP operation needs to be performed on the global label; if the PHP operation does not need to be performed, B directly encapsulates the MPLS data packet into an IP tunnel (for example, a GRE tunnel), and for details, refer to FIG. 4; if the PHP operation needs to be performed, B encapsulates the MPLS data packet into the IP tunnel after peeling the top label of the MPLS data packet, and for details, refer to FIG. 5. If the node segment label corresponding to Z is a local label, B directly encapsulates the MPLS data packet into the IP tunnel after peeling the top label of the MPLS data packet, and for details, refer to FIG. 5. A destination address of the IP tunnel is an IP address of Z, and a source address of the IP tunnel is an IP address of B. An encapsulated MPLS data packet is forwarded in a hop-by-hop IP forwarding manner, that is, is forwarded by using IP of C and D, and reaches a destination (that is, element Z) of the IP tunnel. Z performs IP tunnel decapsulation on the received data packet, and then performs corresponding processing on a decapsulated MPLS data packet.

Certainly, the foregoing example is described by using an example in which the MPLS data packet is forwarded from B to Z hop-by-hop and based on an IP routing table. In an actual application, if a network environment permits, an MPLS data packet B may also be directly forwarded from B to Z and based on the routing table.

Further, in this embodiment of the present application, to make a node located at ingress of the IP tunnel (that is, element B) to learn an IP tunnel encapsulation format supported by an egress node of the IP tunnel (that is, element Z). The node Z advertises, by using an Interior Gateway Protocol (IGP) extension, an IP tunnel encapsulation format supported by the node Z to another SR router in an IGP domain. Specifically, Z may support one or more IP tunnel encapsulation formats, for example, a GRE tunnel and a User Datagram Protocol (UDP) tunnel.

The ISIS is used as an example; Z may implement advertisement of the IP tunnel encapsulation format in the system by carrying, in a router capability type-length-value (Router Capability TLV), an encapsulation capability sub-type-length-value (Encapsulation Capability Sub-TLV) shown in FIG. 6.

A Type field of the encapsulation capability Sub-TLV is filled in with a Type code of an IP tunnel encapsulation format allocated by the Internet Assigned Numbers Authority (IANA), for example, Type code of the GRE tunnel=1 and Sub-TLV Type code of the UDP tunnel=2; if a Length field is set to 0, it indicates that a value field of the Sub-TLV is null.

In this embodiment of the present application, hybrid networking of an SR router and a non-SR router is implemented, thereby a requirement for incremental deployment of SR networks is met. The Non-SR router (such as element C) may be a router that does not have an MPLS forwarding capability at all.

Referring to FIG. 7, in an embodiment of the present application, a first SR router includes a communications unit 70 and a processing unit 71, where:

the communications unit 70 is configured to receive an MPLS data packet; and

the processing unit 71 is configured to encapsulate the MPLS data packet into an IP tunnel when determining that a next-hop router does not support an SR characteristic, and send an encapsulated MPLS data packet to the next-hop router by using the communications unit 70 to enable the encapsulated MPLS data packet to be forwarded, based on an IP routing table, to a second SR router.

That the processing unit 71 encapsulates the MPLS data packet into the IP tunnel specifically includes that:

the processing unit 71 fills in a source address of the IP tunnel with an IP address of the first SR router, and fills in a destination address of the IP tunnel with an IP address of the second SR router.

The processing unit 71 is further configured to:

learn the IP address of the second SR router according to a node segment label at the top of a label stack of the to-be-sent MPLS data packet, where the node segment label at the top of the label stack of the MPLS data packet is a node segment label of the second SR router.

Before the processing unit 71 encapsulates the MPLS data packet into the IP tunnel, the following is included:

the processing unit 71 determines whether the node segment label of the second SR router is a global label; and

if the node segment label is a global label, the processing unit 71 further determines whether a penultimate hop pop (PHP) operation needs to be performed on the global label, where if the PHP operation needs to be performed, a pop operation is performed on the global label, or if the PHP operation does not need to be performed, a pop operation is not performed on the global label; or

if the node segment label is a local label, the processing unit 71 directly performs a pop operation on the local label.

The processing unit 71 is further configured to:

before encapsulating the MPLS data packet into the IP tunnel, learn, according to a tunnel encapsulation capability advertisement sent by the second SR router, an IP tunnel encapsulation type that is used when the MPLS data packet is encapsulated into the IP tunnel.

Referring to FIG. 8, in an embodiment of the present application, a first SR router includes a communications port 80 and a processor 81, where:

the communications port 80 is configured to receive an MPLS data packet; and

the processor 81 is configured to encapsulate the MPLS data packet into an IP tunnel when determining that a next-hop router does not support an SR characteristic, and send an encapsulated MPLS data packet to the next-hop router by using the communications port 80 to enable the encapsulated MPLS data packet to be forwarded, based on an IP routing table, to a second SR router.

That the processor 81 encapsulates the MPLS data packet into the IP tunnel specifically includes that:

the processor 81 fills in a source address of the IP tunnel with an IP address of the first SR router, and fills in a destination address of the IP tunnel with an IP address of the second SR router.

The processor 81 is further configured to:

learn the IP address of the second SR router according to a node segment label at the top of a label stack of the to-be-sent MPLS data packet, where the node segment label at the top of the label stack of the MPLS data packet is a node segment label of the second SR router.

Before the processor 81 encapsulates the MPLS data packet into the IP tunnel, the following is included:

the processor 81 determines whether the node segment label of the second SR router is a global label; and

if the node segment label is a global label, the processor 81 further determines whether a penultimate hop pop PHP operation needs to be performed on the global label, where if the PHP operation needs to be performed, a pop operation is performed on the global label, or if the PHP operation does not need to be performed, the pop operation is not performed on the global label; or

if the node segment label is a local label, the processor 81 directly performs a pop operation on the local label.

The processor 81 is further configured to:

before encapsulating the MPLS data packet into the IP tunnel, learn, according to a tunnel encapsulation capability advertisement sent by the second SR router, an IP tunnel encapsulation type that is used when the MPLS data packet is encapsulated into the IP tunnel.

By using the foregoing solution, correct forwarding of an MPLS data packet is completed in an environment of hybrid networking of an SR router and a non-SR router, thereby meeting a requirement for incremental deployment of SR networks.

A person skilled in the art should understand that the embodiments of the present application may be provided as a method, a system, or a computer program product. Therefore, the present application may use a form of hardware only embodiments, software only embodiments, or embodiments with a combination of software and hardware. Moreover, the present application may use a form of a computer program product that is implemented on one or more computer-usable storage media (including but not limited to a disk memory, a CD-ROM, an optical memory, and the like) that include computer-usable program code.

The present application is described with reference to the flowcharts and/or block diagrams of the method, the device (system), and the computer program product according to the embodiments of the present invention. It should be understood that computer program instructions may be used to implement each process and/or each block in the flowcharts and/or the block diagrams and a combination of a process and/or a block in the flowcharts and/or the block diagrams. These computer program instructions may be provided for a general-purpose computer, a dedicated computer, an embedded processor, or a processor of any other programmable data processing device to generate a machine, so that the instructions executed by a computer or a processor of any other programmable data processing device generate an apparatus for implementing a specific function in one or more processes in the flowcharts and/or in one or more blocks in the block diagrams.

These computer program instructions may also be stored in a computer readable memory that can instruct the computer or any other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory generate an artifact that includes an instruction apparatus. The instruction apparatus implements a specific function in one or more processes in the flowcharts and/or in one or more blocks in the block diagrams.

These computer program instructions may also be loaded onto a computer or another programmable data processing device, so that a series of operations and steps are performed on the computer or the other programmable device, thereby generating computer-implemented processing. Therefore, the instructions executed on the computer or the other programmable device provide steps for implementing a specific function in one or more processes in the flowcharts and/or in one or more blocks in the block diagrams.

Although some preferred embodiments of the present application have been described, a person skilled in the art can make changes and modifications to these embodiments once they learn the basic inventive concept. Therefore, the following claims are intended to be construed as to cover the preferred embodiments of the present application and all changes and modifications falling within the scope of the present application.

Obviously, a person skilled in the art can make various modifications and variations to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. Embodiments of the present application is intended to cover these modifications and variations provided that they fall within the scope of protection defined by the following claims and their equivalent technologies. 

1. A method for sending a multiprotocol label switching (MPLS) data packet, the method comprising: receiving, by a first segment routing (SR) router in an SR network, a tunnel encapsulation capability flooded by a second SR router; determining, by the first SR router, an internet protocol (IP) tunnel encapsulation type according to the tunnel encapsulation capability; encapsulating, by the first SR router, the MPLS data packet into an IP tunnel according to the IP tunnel encapsulation type; and sending, by the first SR router, the encapsulated MPLS data packet to the second SR router.
 2. The method according to claim 1, wherein the tunnel encapsulation capability is flooded by the second SR router using an interior gateway protocol.
 3. The method according to claim 1, wherein the IP tunnel encapsulation type is a type of a header of an encapsulation IP tunnel.
 4. The method according to claim 1, wherein the second SR router support one or more IP tunnel encapsulation types.
 5. The method according to claim 1, wherein the tunnel encapsulation capability comprises an encapsulation capability sub-type-length-value (sub-TLV).
 6. The method according to claim 5, wherein a type field of the encapsulation capability sub-TLV is filled in with a type code of an IP tunnel encapsulation format allocated by the internet assigned numbers authority.
 7. A first segment routing (SR) router comprising: a receiver configured to cooperate with a processor to receive a tunnel encapsulation capability flooded by a second SR router; the processor configured to determine an internet protocol (IP) tunnel encapsulation type according to the tunnel encapsulation capability, and encapsulate a multiprotocol label switching (MPLS) data packet into an IP tunnel according to the IP tunnel encapsulation type; and a transmitter configured to cooperate with the processor to send the encapsulated MPLS data packet to the second SR router.
 8. The first SR router according to claim 7, wherein the tunnel encapsulation capability is flooded by the second SR router using an interior gateway protocol.
 9. The first SR router according to claim 7, wherein the IP tunnel encapsulation type is a type of a header of an encapsulation IP tunnel.
 10. The first SR router according to claim 7, wherein the second SR router support one or more IP tunnel encapsulation types.
 11. The first SR router according to claim 7, wherein the tunnel encapsulation capability comprises an encapsulation capability sub-type-length-value (sub-TLV).
 12. The first SR router according to claim 11, wherein a type field of the encapsulation capability sub-TLV is filled in with a type code of an IP tunnel encapsulation format allocated by the internet assigned numbers authority.
 13. A non-transitory computer readable medium, comprising processor-executable instructions which when executed by a processor of a first segment routing (SR) router in an SR network, causes the first SR router to implement the following method for sending a multiprotocol label switching (MPLS) data packet: receiving a tunnel encapsulation capability flooded by a second SR router; determining an internet protocol (IP) tunnel encapsulation type according to the tunnel encapsulation capability; encapsulating the MPLS data packet into an IP tunnel according to the IP tunnel encapsulation type; and sending the encapsulated MPLS data packet to the second SR router.
 14. The non-transitory computer readable medium according to claim 13, wherein the tunnel encapsulation capability is flooded by the second SR router using an interior gateway protocol.
 15. The non-transitory computer readable medium according to claim 13, wherein the IP tunnel encapsulation type is a type of a header of an encapsulation IP tunnel.
 16. The non-transitory computer readable medium according to claim 13, wherein the second SR router support one or more IP tunnel encapsulation types.
 17. The non-transitory computer readable medium according to claim 13, wherein the tunnel encapsulation capability comprises an encapsulation capability sub-type-length-value (sub-TLV).
 18. The non-transitory computer readable medium according to claim 17, wherein a type field of the encapsulation capability sub-TLV is filled in with a type code of an IP tunnel encapsulation format allocated by the internet assigned numbers authority. 